package com.aaa.ssm.controller;

import com.aaa.ssm.entity.Student;
import com.aaa.ssm.query.StudentQuery;
import com.aaa.ssm.servie.StudentService;
import com.aaa.ssm.util.AjaxResult;
import com.aaa.ssm.vo.StudentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.UUID;

@RestController
@RequestMapping("stu")
public class StudentController {

    @Autowired
    private StudentService studentService;



    @RequestMapping("add")
    public AjaxResult add(StudentVO stu){
        int i = studentService.add(stu);
        return  AjaxResult.success(200,"ok",i);
    }


    @RequestMapping("listStudent")
    public AjaxResult listStudent(StudentQuery query){
        Map<String, Object> map = studentService.listAllStudent(query);
        return  AjaxResult.success(200,"ok",map);
    }

}
